package com.ityu.mapper;

import com.ityu.pojo.Clazz;
import com.ityu.pojo.pagePojo.ClazzPage;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClazzMapper {


    List<Clazz> pageFindClazz(ClazzPage clazzPage);

    @Delete("delete from class where id=#{id}")
    void deleteClass(Integer id);

    @Insert("insert into class(name,room,begin_date,end_date,master_id,subject,create_time,update_time) values(#{name},#{room},#{beginDate},#{endDate},#{masterId},#{subject},#{createTime},#{updateTime})")
   void addClass(Clazz clazz);

    @Select("select * from class where id=#{id}")
    Clazz getClassById(Integer id);


    void updateClass(Clazz clazz);

    @Select("select * from class")
    List<Clazz> listClass();

    @Select("select count(1) from student where clazz_id = #{id}")
    Integer countStudent(Integer id);
}
